package com.xcl.mapper;

import com.xcl.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    //查询文章分类
    @Select("select * from category")
    public List<Category> findAll();
    //删除文章分类
    @Delete("delete from category where id = #{id}")
    public Integer deleteById(Integer id);
    //添加文章分类
    @Insert("insert into category(category_name,category_alias,create_user,create_time,update_time) " +
            "values(#{categoryName},#{categoryAlias},#{createUser},now(),now())")
    public Integer addCategory(Category category);
    //编辑
    @Update("update category set category_name = #{categoryName}," +
            "category_alias = #{categoryAlias}," +
            "create_user = #{createUser}," +
            "update_time = now() " +
            " where id=#{id}")
    public Integer update(Category category);

}
